﻿@model RegisterModel
@{
    ViewBag.Title = "Register";
    Layout = Settings.Current.Permissions.RequireLogin ? "~/Views/Shared/_BareLayout.cshtml" : "~/Views/Shared/_Layout.cshtml";   
}

@using (Html.BeginForm("Register", "User", FormMethod.Post, new { autocomplete = "off" })) {
    <article id="register">
        <h1>Become a member</h1>
        
        <p>As a member you can keep track of your favorite snippets@{if(Settings.Current.Permissions.AllowMembersToCreateSnippets) {<text> and share your own snippets</text>}}.</p>

        @Html.ValidationSummary(true)
        @Html.AntiForgeryToken()
        <hr class="compactForm" />
        <div class="fieldRow">
            <label for="Username">Username</label>
            @Html.EditorFor(model => model.Username)
            @Html.ValidationMessageFor(model => model.Username)
        </div>    

        <hr class="compactForm" />   
    
        <div class="fieldRow">
            <label for="Password">Password</label>
            @Html.EditorFor(model => model.Password)
            @Html.ValidationMessageFor(model => model.Password)
        </div>    
    
        <div class="fieldRow">
            <label for="Password">Confirm your password</label>
            @Html.EditorFor(model => model.ConfirmPassword)
            @Html.ValidationMessageFor(model => model.ConfirmPassword)
        </div>
    
        <hr class="compactForm" />   
     
        <div class="fieldRow">
            <label for="Password">Email <span class="gray">(optional, will never be displayed on site)</span></label>
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>
    
        <div class="buttonRow compactForm">
            <p class="actionText">Already have an account? <a href="@Url.Action("Login", "User")">Login instead</a></p>
            <input type="submit" value="Register" />
        </div>
    </article>

    <script src="@Url.Content("~/assets/scripts/lib/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/assets/scripts/lib/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
}